package com.caigou.modules.center.adapter

import android.text.TextUtils
import com.caigou.comm.base.utils.ImageLoader
import com.caigou.modules.center.R
import com.caigou.modules.center.bean.DynamicItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2022/02/09
 */
class BoardDynamicItemAdapter(dataset: MutableList<DynamicItemBean>) :
    BaseQuickAdapter<DynamicItemBean, BaseViewHolder>(R.layout.item_board_dynamic_list, dataset) {

    override fun convert(holder: BaseViewHolder, item: DynamicItemBean) {
        if (TextUtils.isEmpty(item.headImg)) {
            holder.setImageResource(R.id.item_board_dynamic_iv_avatar, R.drawable.img_comm_avatar)
        } else {
            ImageLoader.loadCircle(context, item.headImg, holder.getView(R.id.item_board_dynamic_iv_avatar))
        }
        holder.setText(R.id.item_board_dynamic_tv_nickname, item.nickName)
    }
}